/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Classes;

import java.util.Date;

/**
 *
 * @author Alexis
 */
public class Edge extends Element {
    
    private String name;
    private int hours;
    private int minutes; 
    private Date start_date;
    private Date final_date;
    private String type;
    private String description;
    private Node node1;
    private Node node2;
    
    public Edge(String name, Node node1, Node node2) {
        super(name);
        this.setNode1(node1);
        this.setNode2(node2);     
        this.hours = 0;
        this.minutes = 0;
        //this.start_date
        //this.final_date
        this.type = "";
        this.description = "";
    }
    
    public Edge(String name, int hours, int minutes, Date start_date, Date final_date, String type, 
            String description, Node node1, Node node2) {
        super(name, description);
        this.setName(name);
        this.setHours(hours);
        this.setMinutes(minutes);
        this.setStartDate(start_date);
        this.setFinalDate(final_date);
        this.setType(type);
        this.setNode1(node1);
        this.setNode2(node2);
    }
    
    public void setName(String name) {
        if (name!= null && !name.isEmpty()) {
            this.name = name;
        }
    }    
    
    public void setHours(int hours) {
        if (hours < 0) {
            this.hours = 0;
        } else {
            this.hours = hours;
        }
    }
    
    public void setMinutes(int minutes) {
        if (minutes < 0) {
            this.minutes = 0;    
        } else {
            int hrs = minutes/60;
            int mins = minutes%60;
            this.hours = hrs;
            this.minutes = mins;
        }
    }
    
    public void setStartDate(Date start_date) {
        if (start_date.before(this.final_date) && !start_date.equals(this.final_date)) {
            this.start_date = start_date;
        }
    }
    
    public void setFinalDate(Date final_date) {
        if (final_date.after(this.start_date) && !final_date.equals(this.start_date)) {
            this.final_date = final_date;
        }
    }
    
    public void setType(String type) {
        if (type!= null && !type.isEmpty()) {
            this.type = type;
        }
    }
    
    public void setDescription (String description) {
        if (description!= null && !description.isEmpty()) {
            this.description = description;
        }
    }
    
    public void setNode1(Node node1) {
        this.node1 = node1;
    }
    
    public void setNode2(Node node2) {
        this.node2 = node2;
    }
    
    public String getName() {
        return this.name;
    }
    
    public int getHours() {
        return this.hours;
    }
    
    public int getMinutes() {
        return this.minutes;
    }
    
    public Date getStartDate() {
        return this.start_date;
    }

    public Date getFinalDate(){
        return this.final_date;
    }
    
    public String getType() {
        return this.type;
    }
    
    public String getDescription() {
        return this.description;
    }
    
    public Node getNode1() {
        return this.node1;
    }
    
    public Node getNode2() {
        return this.node2;
    }
}